#include <iostream>
using namespace std;

// 已知
long long n, a[10086];
// 未知
double t = 0;

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    for (int i = 1; i < n - 1; i++)
    {
        if (a[i - 1] * a[i + 1] != a[i] * a[i])
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}